home *** CD-ROM | disk | FTP | other *** search
-
- /*© copyright 1991-93 UserLand Software, Inc. All RIghts Reserved.*/
-
-
- #include <math.h>
- #include <ucmd.h>
-
-
- #define logtoken 'log '
- #define exptoken 'exp '
- #define stepMultiple 'stpM'
-
-
- int errno; /*see math.c*/
-
-
- static void logverb (void);
- static void expverb (void);
- static void stepMultipleVerb (void);
-
-
- static void logverb (void)
- {
- double x;
-
- if (!IACgetdoubleparam ((OSType) keyDirectObject, &x))
- return;
-
- x = log (x);
- IACreturndouble (x);
- }
-
-
- static void expverb (void)
- {
- double x;
-
- if (!IACgetdoubleparam ((OSType) keyDirectObject, &x))
- return;
-
- x = exp (x);
- IACreturndouble (x);
- }
-
-
- static void stepMultipleVerb (void)
- {
- double steps, scale, multiple;
-
- if (!IACgetdoubleparam('scal', &scale))
- return;
- if (!IACgetdoubleparam('step', &steps))
- return;
-
- if ((scale < 1.0) || (steps < 2.0))
- IACreturndouble( 0.0 );
- else
- {
- multiple = exp( log( scale ) / (steps - 1.0) );
- IACreturndouble( multiple );
- }
- }
-
-
- void UCMDmain (void)
- {
- switch (IACgetverbtoken ())
- {
- case logtoken:
- logverb (); break;
-
- case exptoken:
- expverb (); break;
-
- case stepMultiple:
- stepMultipleVerb(); break;
-
- default:
- IACnothandlederror (); break;
- }
- }
-
-
-